package cn.itsource.basic.domain;

import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.digest.MD5;

public interface CreatePassword {

    String getSalt();

    void setSalt(String salt);

    String getPassword();

    void setPassword(String password);

    default void initMd5() {
        //1.1盐值入库 ,加密之后密码串入库
        String salt = IdUtil.fastSimpleUUID();
        this.setSalt(salt);
        String md5Pwd = MD5.create().setSalt(salt.getBytes()).digestHex(this.getPassword());
        this.setPassword(md5Pwd);
    }

}
